package com.caizi.remote.rmi.server;

import javax.naming.Context;
import javax.naming.InitialContext;

public class ProductServer {

    public static void main(String[] args) {
        try {
            System.out.println("Custructing server implementions...");
            ProductImpl p1 = new ProductImpl("Blackwell Toaster");
            ProductImpl p2 = new ProductImpl("ZapXpress Microwave Oven");
            System.out.println("Binding server implementionsto register... ");
            Context namingContext = new InitialContext();
            namingContext.bind("rmi:toaster", p1);
            namingContext.bind("rmi:microwave", p2);
            System.out.println("Waiting for invcation from clients...");
        } catch (Exception e) {
            e.printStackTrace();
        }

    }
}
